********************************************************************************
* Modelling Nash Equilibrium for industrial gas market                         *
* Lei Zhang                                                                    *
* 09/26/2013                                                                   *
********************************************************************************

SETS
    i   our_facilities          /F1*F2/
    ii  competitor's_facilities /FC1*FC2/
    j   markets                 /M1*M4/
    k   products                /LOX, LNI, GOX, GNI/
    t   time_periods            /T1*T4/;

*------------------------------------------------------------------------------*

PARAMETERS
    fa(k)   price_elasticity_a  /LOX -0.01, LNI -0.01, GOX -0.01, GNI -0.01/
    fb(k)   price_elasticity_b  /LOX 2.5, LNI 2.5, GOX 2.5, GNI 2.5/
    fac(k)  price_elasticity_ac /LOX -0.005, LNI -0.005, GOX -0.005, GNI -0.005/
    fbc(k)  price_elasticity_bc /LOX 3.1, LNI 3.1, GOX 3.1, GNI 3.1/;

TABLE D(j,k,t) Demand_of_market
        T1      T2      T3      T4
M1.LOX  15.0    16.5    18.2    20.0
M1.LNI  35.0    38.5    42.4    46.6
M1.GOX  15.0    16.5    18.2    20.0
M1.GNI  35.0    38.5    42.4    46.6
M2.LOX  10.0    11.0    12.1    13.3
M2.LNI  30.0    33.0    37.4    41.1
M2.GOX  10.0    11.0    12.1    13.3
M2.GNI  30.0    33.0    37.4    41.1
M3.LOX   5.0     5.5     6.1     6.7
M3.LNI  15.0    16.5    18.2    20.0
M3.GOX   5.0     5.5     6.1     6.7
M3.GNI  15.0    16.5    18.2    20.0
M4.LOX  10.0    11.0    12.1    13.3
M4.LNI  35.0    38.5    42.4    46.6
M4.GOX  10.0    11.0    12.1    13.3
M4.GNI  35.0    38.5    42.4    46.6;

TABLE CC(ii,k) Capacity_of_competitor's_facility
        LOX     LNI     GOX     GNI
FC1     30      50      20      40
FC2     30      50      20      40;

TABLE c(i,k,t) Capacity_of_facilities
        T1      T2      T3      T4
F1.LOX  21.8    21.8    30.3    30.3
F1.LNI  62.375  62.375  62.375  62.375
F1.GOX  40.0    40.0    40.0    40.0
F1.GNI  62.0625 62.0625 62.0625 62.0625
F2.LOX  18.2    18.2    18.2    18.2
F2.LNI  52.625  52.625  52.625  52.625
F2.GOX  0.0     0.0     8.5     8.5
F2.GNI  52.9375 52.9375 52.9375 52.9375;

*------------------------------------------------------------------------------*

VARIABLES
    cost            Markets'_cost
    
POSITIVE VARIABLES
    y(i,j,k,t)      Amount_of_product_that_facility_sells_to_market
    yc(ii,j,k,t)    Amount_of_product_that_competitor's_facility_sells_to_market
    p(i,k,t)        price_of_products
    pc(ii,k,t)      competitor's_price_of_products

*------------------------------------------------------------------------------*

EQUATIONS
    obj             Objective_function_maximize_the_NPV
    dmd(i,k,t)      Demand_satisfaction_to_the_installed_capacity
    tdm(j,k,t)      Demand_satisfaction_for_all_markets
    dmdc(ii,k,t)    Demand_satisfaction_to_the_installed_competitor's_capacity
    pe(i,k,t)       Price_elasticity
    pec(ii,k,t)     Competitor's_price_elasticity;

obj..               cost =e= SUM((i,j,k,t), p(i,k,t)*y(i,j,k,t))
                        +SUM((ii,j,k,t), pc(ii,k,t)*yc(ii,j,k,t));

dmd(i,k,t)..        c(i,k,t) =g= SUM(j, y(i,j,k,t));
tdm(j,k,t)..        SUM(i, y(i,j,k,t))+SUM(ii, yc(ii,j,k,t)) =e= D(j,k,t);
dmdc(ii,k,t)..      CC(ii,k) =g= SUM(j, yc(ii,j,k,t));
pe(i,k,t)..         p(i,k,t) =e= fa(k)*c(i,k,t)+fb(k);
pec(ii,k,t)..       pc(ii,k,t) =e= fac(k)*CC(ii,k)+fbc(k);

*------------------------------------------------------------------------------*

MODEL TEST_SLAVE_NASH_COMPETITOR /ALL/;
SOLVE TEST_SLAVE_NASH_COMPETITOR USING NLP MINIMIZING cost;

********************************************************************************
